package psn.zjk.exporter;

import org.apache.poi.xssf.usermodel.XSSFCellStyle;

import java.text.MessageFormat;
import java.util.List;

/**
 * @author sdyt_zhangjunkai
 * @version 1.0
 * @CLASS_NAME SheetColumn
 * @DESCRIPTION
 * @CREATE_TIME 2020/9/2 14:36
 */
public class SheetCells implements Comparable<SheetCells> {
    private int index;
    // 列头属性
    private String header;
    // 展示列头
    private String shownHeader;
    private XSSFCellStyle columnStyle;
    private Object pojo;
    private List<Object> cells;

    public SheetCells(int index) {
        this.index = index;
    }

    public String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }

    public String getShownHeader() {
        return shownHeader;
    }

    public void setShownHeader(String shownHeader) {
        this.shownHeader = shownHeader;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public XSSFCellStyle getStyle() {
        return columnStyle;
    }

    public void setStyle(XSSFCellStyle columnStyle) {
        this.columnStyle = columnStyle;
    }

    @Override
    public int compareTo(SheetCells o) {
        if (o == null) {
            return 0;
        }
        return index - o.getIndex();
    }

    @Override
    public String toString() {
        return MessageFormat.format("{0}:{1}", index, shownHeader);
    }

    public Object getPojo() {
        return pojo;
    }

    public void setPojo(Object pojo) {
        this.pojo = pojo;
    }

    public List<Object> getCells() {
        return cells;
    }

    public void setCells(List<Object> cells) {
        this.cells = cells;
    }
}
